import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'app_plugin_platform_interface.dart';

/// An implementation of [AppPluginPlatform] that uses method channels.
class MethodChannelAppPlugin extends AppPluginPlatform {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  final methodChannel = const MethodChannel('app_plugin');

  @visibleForTesting
  final vpnMethodChannel = const MethodChannel('vpn_plugin');

  @override
  Future<String?> getPlatformVersion() async {
    final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
    return version;
  }

  @override
  Future<void> startVpn(String configJson) async {
    final result = await vpnMethodChannel.invokeMethod<void>('startVpn',{
      "configJson":configJson
    });
    return result;
  }

  @override
  Future<void> stopVpn() async {
    final result = await vpnMethodChannel.invokeMethod<void>('stopVpn');
    return result;
  }
}
